/*
 * Jenny Ruppen 09-730-391
 * Sebastien Goldberg 08-914-855
 * Henry Raymond 08-928-061
 * Stefan Mussato 09-752-270
 */
 
package ch.uzh.ifi.sopra.gruppe9.game;

//import java.net.MalformedURLException;
//import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

/**
 * Static class for client-side server functionality. Sets up Server and registers all remote objects with RMI.
 * This server is used only for update reports sent from the server to the client.
 */
public final class UpdateSubscriberServer {
	
	
	/**
	 * Unique instance of this class. Sets up registry and registers players.
	 */
	private static UpdateSubscriberServer instance;

	
	/**
	 * Constructor: set up Server
	 */
	private UpdateSubscriberServer() throws RemoteException {
		//Create Registry for RMI
		try {
			LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
		} catch (RemoteException ex) {
			System.out.println(ex.getMessage());
		}
	}

	
	/**
	 * Get unique instance of Server
	 */
	public static UpdateSubscriberServer createInstance() throws RemoteException {
		//if(instance == null)
			instance = new UpdateSubscriberServer();
		return instance;
	}

}
